package com.campus.course.controller;

import com.campus.common.result.Result;
import com.campus.course.dto.form.ArrangeCourseForm;
import com.campus.course.service.ICourseScheduleService;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/courseSchedule")
@Tag(name = "课程时间服务")
public class CourseScheduleController {
    @Autowired
    private ICourseScheduleService courseScheduleService;

    @ApiOperation(value = "排课")
    @PostMapping("/arrange-course")
    public Result arrangeCourse (@RequestBody ArrangeCourseForm arrangeCourseForm) {
        return courseScheduleService.arrangeCourse(arrangeCourseForm);
    }

    @ApiOperation(value = "学生获取课表")
    @GetMapping("/get-table/{weekDay}")
    public Result getStudentCourseTable(@PathVariable("weekDay") int weekDay) {
        return courseScheduleService.getStudentCourseTable(weekDay);
    }

    @ApiOperation(value = "删除排课")
    @DeleteMapping("/delete-schedule/{scheduleId}")
    public Result deleteCourseSchedule(@PathVariable("scheduleId") int scheduleId) {
        return courseScheduleService.deleteCourseSchedule(scheduleId);
    }
}
